mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 22:21:09 +03:00
std.process: Skip permission test when running as root
A spawnProcess unittest checks that we are unable to enter a directory if we don't have the right permissions. However, programs running under the root user can chdir to a directory, despite it not having execute permissions. Thus, skip this test when running as root.
This commit is contained in:
parent
2882ff113f
commit
d777855000
1 changed files with 10 additions and 7 deletions
|
@ -1187,6 +1187,8 @@ version (Posix) @system unittest
|
|||
|
||||
// can't run in directory if user does not have search permission on this directory
|
||||
version(Posix)
|
||||
{
|
||||
if (core.sys.posix.unistd.getuid() != 0)
|
||||
{
|
||||
import core.sys.posix.sys.stat : S_IRUSR;
|
||||
auto directoryNoSearch = uniqueTempPath();
|
||||
|
@ -1197,6 +1199,7 @@ version (Posix) @system unittest
|
|||
assertThrown!ProcessException(spawnProcess(prog.path, null, Config.detached, directoryNoSearch));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@system unittest // Specifying empty working directory.
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue