diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2021-11-30 16:34:52 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-30 16:34:52 -0500 |
| commit | ace4e334bc5fb299d2890b5e3f35dfd84ea32606 (patch) | |
| tree | 9a18aa01dda4c8e8b7305bddfd7009fdb8e11a95 /source/core/unix | |
| parent | dd18f2bff2abd13548742e30c25a31b9ea9a0cbd (diff) | |
Use test-server on CI (#2034)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Vary what SpawnType is used, if one isn't explicitly set.
* Terminate on linux if exec fails.
* Use a more sophisticated sleeping mechanism.
* Attempt to make CI tests to work on aarch64 debug.
Small fixes.
Diffstat (limited to 'source/core/unix')
| -rw-r--r-- | source/core/unix/slang-unix-process.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source/core/unix/slang-unix-process.cpp b/source/core/unix/slang-unix-process.cpp index 5131e37ec..4e8344486 100644 --- a/source/core/unix/slang-unix-process.cpp +++ b/source/core/unix/slang-unix-process.cpp @@ -349,6 +349,8 @@ SlangResult UnixPipeStream::write(const void* buffer, size_t length) return StringEscapeUtil::getHandler(StringEscapeUtil::Style::Space); } +static const int kCannotExecute = 126; + /* static */SlangResult Process::create(const CommandLine& commandLine, Process::Flags flags, RefPtr<Process>& outProcess) { List<char const*> argPtrs; @@ -376,6 +378,12 @@ SlangResult UnixPipeStream::write(const void* buffer, size_t length) return SLANG_FAIL; } + // TODO(JS): + // Ideally we'd have a mechanism to test if execvp can be successfully executed (at least in principal) before + // doing fork. Once we have forked we then have the problem of communicating to the parent process somehow. + // + // We could do a search down PATH and test files etc, but this seems to repeat a lot of the functionality of exec. + // pid_t childPid = fork(); if (childPid == -1) { @@ -402,6 +410,11 @@ SlangResult UnixPipeStream::write(const void* buffer, size_t length) ::close(stdinPipe[0]); ::close(stdinPipe[1]); + // TODO(JS): Strictly speaking if m_executableType is 'Path' then we shouldn't be searching. Ie which + // exec we use here should be dependent on the executable type. + + // Path = execvp + // Filename = execv ::execvp(argPtrs[0], (char* const*)&argPtrs[0]); // If we get here, then `exec` failed @@ -410,6 +423,9 @@ SlangResult UnixPipeStream::write(const void* buffer, size_t length) // the terminal but in the stderrPipe. fprintf(stderr, "error: `exec` failed\n"); + // Terminate with failure. + exit(kCannotExecute); + return SLANG_FAIL; } else |
