pipe + exec duplicate stdout linux
void ejecutar(char **argv){/*Funcion que ejecuta el exec*/
int pip[2];
pid_t pid;
pid = fork();
//printf(stdout);
char buf[128];
if(pid == -1){/*ERROR AL HACER FORK*/
perror("FALLA FORK");
exit(EXIT_FAILURE);
}else if(pid == 0){/*PORCESO HIJO*/
close(pip[0]);/*cerramos la entrada*/
write(pip[1],buf,sizeof(buf));/*escribimos por el buffer*/
close(pip[1]);
exit(0);
if(execvp(argv[0],argv)){
perror("Falla Exec");
exit(1);
}
}else{/*PROCESO PADRE*/
wait(NULL);
close(pip[1]);/*cerramos la salida*/
read(pip[0],buf,sizeof(buf));
close(pip[0]);
wait(NULL);
//kill(ret,SIGTERM);
}
}
Also in Shell:
- Gem::LoadError : "ed25519 is not part of the bundle. Add it to your Gemfile."
- use python shell with git bash
- git pull hard
- raspberry shell get datetime now
- powershell get date
- git copy file from another branch
- how to push force git
- angular add component
- raspbian start gui manually
- grep search for text in php files recursive
- get ip address linux
- git rename branch
- forecfully remove directory
- vim compare 2 files
- redirect folder to 403
- linux delete appledouble ds_store files
- install packages with pip from python
- bash compare two strings
- git ignore global
- convert all files and folders in current directory into zip in linux
- upgrade yarn version
- install virtualenv conda
- connect local repository to remote git
- shell script variable