revert: "jobstart(): Fix hang on non-executable cwd #9204" (#19826)

This reverts commit c4c74c3883.

LibUV already gives an error for this, so this isn't needed.
This commit is contained in:
zeertzjq
2022-08-18 22:09:50 +08:00
committed by GitHub
parent 700a6fb9d4
commit 36f0b508c5
4 changed files with 5 additions and 25 deletions

View File

@@ -315,8 +315,6 @@ Channel *channel_job_start(char **argv, CallbackReader on_stdout, CallbackReader
ChannelStdinMode stdin_mode, const char *cwd, uint16_t pty_width,
uint16_t pty_height, dict_T *env, varnumber_T *status_out)
{
assert(cwd == NULL || os_isdir_executable(cwd));
Channel *chan = channel_alloc(kChannelStreamProc);
chan->on_data = on_stdout;
chan->on_stderr = on_stderr;

View File

@@ -4567,7 +4567,7 @@ static void f_jobstart(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (new_cwd && *new_cwd != NUL) {
cwd = new_cwd;
// The new cwd must be a directory.
if (!os_isdir_executable((const char *)cwd)) {
if (!os_isdir((const char_u *)cwd)) {
semsg(_(e_invarg2), "expected valid directory");
shell_free_argv(argv);
return;
@@ -9361,7 +9361,7 @@ static void f_termopen(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (new_cwd && *new_cwd != NUL) {
cwd = new_cwd;
// The new cwd must be a directory.
if (!os_isdir_executable(cwd)) {
if (!os_isdir((const char_u *)cwd)) {
semsg(_(e_invarg2), "expected valid directory");
shell_free_argv(argv);
return;

View File

@@ -144,25 +144,6 @@ bool os_isdir(const char_u *name)
return true;
}
/// Check if the given path is a directory and is executable.
/// Gives the same results as `os_isdir()` on Windows.
///
/// @return `true` if `name` is a directory and executable.
bool os_isdir_executable(const char *name)
FUNC_ATTR_NONNULL_ALL
{
int32_t mode = os_getperm(name);
if (mode < 0) {
return false;
}
#ifdef WIN32
return (S_ISDIR(mode));
#else
return (S_ISDIR(mode) && (S_IXUSR & mode));
#endif
}
/// Check what `name` is:
/// @return NODE_NORMAL: file or directory (or doesn't exist)
/// NODE_WRITABLE: writable device, socket, fifo, etc.