fix: don't invoke if no args
This commit is contained in:
parent
3d318439d8
commit
4f09deb394
2 changed files with 5 additions and 2 deletions
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
unsigned char invoke(struct Args args) {
|
unsigned char invoke(struct Args args) {
|
||||||
pid_t child = fork();
|
pid_t child = fork();
|
||||||
if (child == 0 && args.argc > 0) {
|
if (child == 0) {
|
||||||
execvp(args.argv[0], args.argv);
|
execvp(args.argv[0], args.argv);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,10 @@ int main() {
|
||||||
struct Args args = parse(input_line);
|
struct Args args = parse(input_line);
|
||||||
free(input_line);
|
free(input_line);
|
||||||
|
|
||||||
invoke(args);
|
if (args.argc > 0) {
|
||||||
|
invoke(args);
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
while (i < args.argc) {
|
while (i < args.argc) {
|
||||||
|
|
Loading…
Reference in a new issue