xaizek / vifm (License: GPLv2+) (since 2018-12-07)
Vifm is a file manager with curses interface, which provides Vi[m]-like environment for managing objects within file systems, extended with some useful ideas from mutt.
Commit fea00a51fda2be031c975805f39f9947e6dc25f3

Test that commands starting with `-` can be run
Author: xaizek
Author date (UTC): 2024-04-14 11:44
Committer name: xaizek
Committer date (UTC): 2024-04-14 11:44
Parent(s): 51ea56fee5f45e9e13a8e929201687bed8e04c77
Signing key: 99DC5E4DB05F6BE2
Tree: b6ebb17ac9b9de78d5689ba8a5fd9081691e7881
File Lines added Lines deleted
tests/misc/background.c 22 0
File tests/misc/background.c changed (mode: 100644) (index 6978e1a53..db27be9b9)
3 3 #include <unistd.h> /* chdir() usleep() */ #include <unistd.h> /* chdir() usleep() */
4 4
5 5 #include <stdio.h> /* FILE fclose() fputs() */ #include <stdio.h> /* FILE fclose() fputs() */
6 #include <stdlib.h> /* free() */
7 #include <string.h> /* strdup() */
6 8
7 9 #include <test-utils.h> #include <test-utils.h>
8 10
 
10 12 #include "../../src/engine/var.h" #include "../../src/engine/var.h"
11 13 #include "../../src/engine/variables.h" #include "../../src/engine/variables.h"
12 14 #include "../../src/utils/cancellation.h" #include "../../src/utils/cancellation.h"
15 #include "../../src/utils/env.h"
13 16 #include "../../src/utils/string_array.h" #include "../../src/utils/string_array.h"
14 17 #include "../../src/ui/ui.h" #include "../../src/ui/ui.h"
15 18 #include "../../src/background.h" #include "../../src/background.h"
 
... ... TEST(background_redirects_streams_properly, IF(not_windows))
267 270 assert_success(bg_and_wait_for_errors("echo a", &no_cancellation)); assert_success(bg_and_wait_for_errors("echo a", &no_cancellation));
268 271 } }
269 272
273 TEST(can_run_command_starting_with_a_dash, IF(not_windows))
274 {
275 char sandbox[PATH_MAX + 1];
276 make_abs_path(sandbox, sizeof(sandbox), SANDBOX_PATH, "", /*cwd=*/NULL);
277
278 create_executable(SANDBOX_PATH "/-script");
279 make_file(SANDBOX_PATH "/-script", "#!/bin/sh");
280
281 char *saved_path_env = strdup(env_get("PATH"));
282 env_set("PATH", sandbox);
283
284 assert_success(bg_and_wait_for_errors("-script", &no_cancellation));
285
286 env_set("PATH", saved_path_env);
287 free(saved_path_env);
288
289 remove_file(SANDBOX_PATH "/-script");
290 }
291
270 292 static void static void
271 293 task(bg_op_t *bg_op, void *arg) task(bg_op_t *bg_op, void *arg)
272 294 { {
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vifm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vifm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master