mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 22:14:53 +00:00
Handle getcwd failures to satisfy the linter
This commit is contained in:
parent
c59f5e9f01
commit
78af59f40c
1 changed files with 10 additions and 2 deletions
|
@ -2037,7 +2037,11 @@ static void test_complete(void)
|
||||||
|
|
||||||
/* File completions */
|
/* File completions */
|
||||||
char saved_wd[PATH_MAX + 1] = {};
|
char saved_wd[PATH_MAX + 1] = {};
|
||||||
(void)getcwd(saved_wd, sizeof saved_wd);
|
if (!getcwd(saved_wd, sizeof saved_wd))
|
||||||
|
{
|
||||||
|
perror("getcwd");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
if (system("mkdir -p '/tmp/complete_test/'")) err(L"mkdir failed");
|
if (system("mkdir -p '/tmp/complete_test/'")) err(L"mkdir failed");
|
||||||
if (system("touch '/tmp/complete_test/testfile'")) err(L"touch failed");
|
if (system("touch '/tmp/complete_test/testfile'")) err(L"touch failed");
|
||||||
if (chdir("/tmp/complete_test/")) err(L"chdir failed");
|
if (chdir("/tmp/complete_test/")) err(L"chdir failed");
|
||||||
|
@ -3891,7 +3895,11 @@ int main(int argc, char **argv)
|
||||||
while (access("./tests/test.fish", F_OK) != 0)
|
while (access("./tests/test.fish", F_OK) != 0)
|
||||||
{
|
{
|
||||||
char wd[PATH_MAX + 1] = {};
|
char wd[PATH_MAX + 1] = {};
|
||||||
(void)getcwd(wd, sizeof wd);
|
if (!getcwd(wd, sizeof wd))
|
||||||
|
{
|
||||||
|
perror("getcwd");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
if (! strcmp(wd, "/"))
|
if (! strcmp(wd, "/"))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Unable to find 'tests' directory, which should contain file test.fish\n");
|
fprintf(stderr, "Unable to find 'tests' directory, which should contain file test.fish\n");
|
||||||
|
|
Loading…
Reference in a new issue