Salome HOME
projects
/
modules
/
kernel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
57d3239
)
USER or LOGNAME is not defined in a Docker container: on Linux get username with...
emc2_project
emc2p/BR_V1_3_7
emc2p_1.3.7-rc1
author
Gilles DAVID
<gilles-g.david@edf.fr>
Thu, 30 Mar 2023 17:13:55 +0000
(19:13 +0200)
committer
Gilles DAVID
<gilles-g.david@edf.fr>
Thu, 30 Mar 2023 17:13:55 +0000
(19:13 +0200)
src/Launcher/Launcher_Job.cxx
patch
|
blob
|
history
diff --git
a/src/Launcher/Launcher_Job.cxx
b/src/Launcher/Launcher_Job.cxx
index e878a7404d19383ea787106d6521cdcf69c47022..b724958185a52363ba6549f74f733231b1e643f5 100644
(file)
--- a/
src/Launcher/Launcher_Job.cxx
+++ b/
src/Launcher/Launcher_Job.cxx
@@
-37,6
+37,7
@@
#include <process.h>
#else
static const char SEPARATOR = '/';
+#include <pwd.h>
#endif
Launcher::Job::Job()
@@
-191,7
+192,12
@@
Launcher::Job::setResourceDefinition(const ParserResourcesType & resource_defini
if (resource_definition.UserName == "")
{
#ifndef WIN32
- user_name = getenv("USER");
+ struct passwd *pwd = getpwuid(getuid());
+ if (pwd) {
+ user_name = std::string(pwd->pw_name);
+ }
+ if (user_name == "")
+ user_name = getenv("USER");
#else
user_name = getenv("USERNAME");
#endif