Questions tagged [exec]

This tag refers to the starting of another, subsidiary program. It is named after the family of POSIX system calls whose name starts with “exec” (notably “execve”) though similar concepts exist on other platforms as well, especially when combined with the starting up of another process.

Filter by
Sorted by
Tagged with
0 votes
0 answers
34 views

Python call from website is causing webpage to hang

I have spent a little time looking through the site, but ultimately wind up at the same place with code that stops functioning. I'm a coding novice and currently trying to learn HTML, PHP, python and ...
bassjuggler's user avatar
0 votes
1 answer
11 views

How to execute program that using threads in node.js?

#!/usr/bin/node const { spawn } = require("child_process"); const ls = spawn("./vanitygen", ["-p bc1qu"]); ls.stdout.on("data", data => { console.log(`...
gkucmierz's user avatar
  • 1,075
1 vote
1 answer
57 views

Can a Rust executable recompile and re-execute itself?

While doing development in Rust/Axum/Askana (which compiles templates at compile time) it would be very useful if the server executable could, during development: watch for any changes to files in ...
fadedbee's user avatar
  • 43.1k
2 votes
1 answer
68 views

Valgrind is reporting the Impossible happened using an fexecve call

I have a program that loads a simple hello world binary into memory using memfd_create and then writing the binary data to the file with write. I then fork a process and call fexecve. The code works ...
SCRWarEagle's user avatar
0 votes
0 answers
37 views

exec close file descriptor not found error

I just use exec {fd}<>myfile to open a file and get the fd. After using, I want to close it with exec $fd<&-, but bash error "exec: 10: not found".Why this happen? At last I use ...
kingkong's user avatar
  • 129
1 vote
1 answer
48 views

Select value from table? Bash

I want to extract the value of ID in a single command, I think this is a table but i'm not sure. id -------------------------------------- 00000000-0000-0000-00000-...
userno's user avatar
  • 15
0 votes
1 answer
35 views

Golang exec.Command Process

The goal is to run bun create vite <project-name> via Golang's exec library. The problem is that bun create vite <project-name> prompts you to "Select a framework" How would I ...
David Serrano's user avatar
0 votes
0 answers
29 views

Install the package in the terminal by shell_exec

I need to install a package from github in the php exec shell function. But in the installation phase, it asks me for 4 answers. username password port y/n I want to enter the answers in order in the ...
hamid reza's user avatar
0 votes
1 answer
53 views

Execute python file in cpp

I want to execute a python file in cpp, to make it a process that can communicate with my other child process. But when I use execl("python3", "python3", "python/a1.py"); ...
Brian's user avatar
  • 11
0 votes
0 answers
50 views

Getting correct path to current script when running from exec()

When I run one python file from another python file by using exec(), the __file__ attribute is the caller's path not the callee: file caller.py: with open("callee.py", "r") as ...
Periodic Maintenance's user avatar
1 vote
1 answer
33 views

Problem with output from exec('7za.exe e -so ...')

It feels like some of the data is being cut off somewhere: @exec('7za.exe" e -so "archive.zip" "img.jpg"', $out); $out - is a array of bin data $data = implode( "" ,...
Dmitry's user avatar
  • 13
0 votes
0 answers
52 views

k8s exec command terminated but the remote command does not

I am using k8s remote exec command to run a http server (via cmd). When the host program terminated (Ctrl+C), the remote command still running at the remote container. How to terminate the remote ...
user1929999's user avatar
0 votes
0 answers
35 views

bash script in udev rule is taking longer time, normal in terminal will run quickly und success

in my case i have no idea what goes wrong. i have a custom udev.rule /etc/udev/rules.d/99-printer.rules ACTION=="add", SUBSYSTEM=="usb", RUN+="/usr/local/bin/reg_printer.sh&...
ttstickerz's user avatar
-3 votes
1 answer
67 views

Run .jar file on a PHP page [closed]

Good evening, I have a .jar file and I want it to be executed when the user accesses a specific php page on my website. Print of how I wanted I have already tried with exec and shell_exec but it is ...
Iago Sampaio's user avatar
0 votes
0 answers
19 views

Js child_process command not found

I have done the following two tests, to know the version of node I am using but I am getting the following errors. Can you tell me where I'm wrong? Test1: import { exec as cExec } from "...
Paul's user avatar
  • 3,926
2 votes
2 answers
37 views

How to get the callable function defined by exec() in Python?

Say I want to have a function exec_myfunc that can execute any user-defined function with an input value of 10. The user is supposed to define the function by a string as shown below: func1_str = &...
Shaun Han's user avatar
  • 2,730
0 votes
1 answer
51 views

C# Kubernetes Client Exec Command into Pod Container Issue

I have a custom web application written in .NET7 and I am using Kubernetes Client (C#) to interact with a Kubernetes Cluster (Azure). So far so good, everything is working as expected unit I reached ...
Stavros Koureas's user avatar
0 votes
0 answers
36 views

Is there a way to call up a variable of a PHP file running through exec command?

I ran into a small problem that I'd like to deal with, but still haven't found a solution yet. I'm making a specific WordPress/WooCommerce plugin that makes adjustments to prices based on the price ...
Александр Савенков's user avatar
1 vote
1 answer
44 views

Getting the default browser runnning on a windows system

I am trying to write code to return the path to the default browser on windows system. I have run this command in the temrinal : for /f "tokens=3" %a in ('reg QUERY HKCU\SOFTWARE\Microsoft\...
Mohammed Dalloul's user avatar
0 votes
1 answer
42 views

How does exec* functions manage multithreaded process?

In POSIX standards, calling exec* in a thread will cause the entire process to be replaced with a new process, resulting in termination of all threads of the process. But how does exec* terminate all ...
Sourav Kannantha B's user avatar
0 votes
1 answer
97 views

How to understand the "$0" "$@" after `exec python3 "$0" "$@" `

I do not quite follow the following code snippet from https://github.com/nodejs/node/blob/main/configure#L6-L16. In particular, what does "$0" "$@" mean right after sh -c ```<...
Lala James's user avatar
1 vote
2 answers
183 views

The shell_exec and exec() commands don't work on linux Ubuntu in my localhost Ububtu 20.04

The following code only works in my Terminal but it doesn't work in my localhost xampp linux Unbuntu 20.04, Both shell_exec() and exec() don't work. When I go to localhot it executes all the code but ...
Junior Oge's user avatar
0 votes
1 answer
25 views

No speed difference found when running exec(scp) in the background

I'm trying to copy asyncronously 10 70 MB video files. exec("scp -o StrictHostKeyChecking=accept-new -i /var/keys/devDevices_rsa MarTianez1.mp4 awon[email protected]:/tmp/test1 2>&1 > out.log&...
tirenweb's user avatar
  • 31.2k
0 votes
0 answers
35 views

Main Gui Thread Freezes after using a QDialog with Exec_()

I shared the summary of my code below and I should state that dialogPopup is an instance of Ui_Dialog.The problem is when I press Ok or Cancel, the popup closes as expected and I get the result_code ...
okosucu17's user avatar
0 votes
1 answer
37 views

Capturing stdout, stderr from a running thread at runtime

I'm trying to capture stdout and stderr from an exec() call at runtime i.e. before it completes. I have wrapped it in a thread under a contextlib context to redirect output but with no success. I'm ...
Francisco Gama T. R.'s user avatar
0 votes
1 answer
28 views

Python import works, read text from file and exec doesn't

I have a file data.py in directory exectest containing testd = { 1: "one", 2: "two" } When I type import data, I get In [5]: import data In [6]: data.testd Out[6]: {1: 'one', 2: '...
Rodney Price's user avatar
0 votes
1 answer
64 views

Running exec("nohup curl ...") in PHP and redirecting stderr

I have a piece of php code that executes multiple curl request using the exec() function. The goal is to download a lot of files simultaneously, at the same keep track of the PIDs as well as the ...
albertma789's user avatar
0 votes
2 answers
51 views

dont understand this fork/exec type program. I dont get how B will be printed twice

Below is the code of the prog1 program. Assume that the execution of a program is successful unless a query explicitly states otherwise. this is the code: int main(int argc,char *argv[]){ ...
Mike Balts's user avatar
1 vote
1 answer
74 views

What happens to child process once the shell command is completed?

So i am using exec to open a shell and run a shell command for me which is: exec('del filename & exit') Using exit to close the Shell I have to use this exec multiple times in a single run, i ...
user avatar
0 votes
0 answers
50 views

Why is the passed argument "not defined" in the exec(), even though the argument is defined in the same function?

I'm trying to dynamically create pages when each button is pressed. In the following code I pass the canvas of the current page into the next function so that it can be deleted ( preventing multiple ...
Alex Myladoor's user avatar
0 votes
1 answer
26 views

PHP exec date -s runs fine but does not update datetime

Here my simple PHP file: <?php if (strtoupper($_SERVER['REQUEST_METHOD']) === 'POST') { if (isset($_POST['datetime'])) { $datetime = htmlspecialchars($_POST['datetime']); $...
Mark's user avatar
  • 4,448
0 votes
1 answer
92 views

C program with forks only prints output if I don't use wait()

I'm writing some programs in C to learn about child processes and I'm having a little trouble with the code below. The idea is to simulate bash commands with pipes using exec, unnamed pipes and copy2, ...
Davidbowie123's user avatar
0 votes
2 answers
69 views

PHP exec() fails when trying to run .bat file

I have a server running from XAMPP on my pc and when I try to run exec('generate_image.bat') it returns false, so it fails. However when I run the .bat myself it runs perfectly. The exec method also ...
Kaboka22's user avatar
0 votes
1 answer
130 views

How can I kill a php-fpm process without the signal being logged in the fpm log

I have a function that through exec() kills a php-fpm process. exec("kill -9 ".$pid); Everytime I call it, a line gets added to the php-fpm log WARNING: [pool xxxxxx] child 18120 exited on ...
greg's user avatar
  • 433
1 vote
3 answers
196 views

How to compile Python code into byte code?

For example imagine I have myfile.py. sample code: a = 6 b = 4 print(a+b) So how can I convert this into bytecode? I tried this: source_code = '''a = 6 b = 4 print(a+b)''' compiled_code = compile(...
Dimuth De Zoysa's user avatar
1 vote
0 answers
198 views

Send Ctrl + C signal to PowerShell

I want to start PowerShell, execute a command and be able to terminate it at any time. I use exec.Command() to start PowerShell with a few flags and then the -command $pid, I figured I could just open ...
Niu's user avatar
  • 51
1 vote
0 answers
66 views

terminate command execution

I want to execute powershell commands using the exec.Command() function, and I also want to be able to stop/terminate command execution at any point. cmd := exec.Command("powershell.exe", &...
Niu's user avatar
  • 51
0 votes
1 answer
37 views

How to stop writing to a file execv

I am trying to write only to a file when a user specifies which file to write in with ">". The first iteration works fine, but when a user types any command after the one where they ...
Wragnam's user avatar
  • 33
0 votes
0 answers
51 views

Nomad Hadoop installation error "Failed to download artifact : getter subprocess failed: exit status 1"

I'm using Nomad v1.6.1 and I tried to run Hadoop cluster on nomad by downloading a binary file using "exec" driver. However, there's still showing an error " Failed to download artifact ...
Spanner 's user avatar
1 vote
1 answer
43 views

Why is `compile()` needed for `exec()`?

My module path = "..\blah\blah\myfolder\mymodule.py" contains: print('hi') Code execution: exec(compile(open(path, 'rb').read(), path, 'exec')) and exec(open(path, 'rb').read()) give the ...
ugorek's user avatar
  • 113
0 votes
0 answers
17 views

How to change a variable in python using exec()? [duplicate]

I tried to create a small function using the exec() command. I works fine and the string in the exec() command gets assembled correctly. The function: def get_random_persons_by_attributes(self, ...
HerrLehrer99's user avatar
0 votes
0 answers
67 views

PHP execute command line tool to print html content

I am using a command line tool to auto print a dynamic page using php exec but unfortunately due to hard disk failure I have reinstall the window and after that that auto print feature is not working ...
Pearl's user avatar
  • 23
1 vote
1 answer
116 views

Different PHP versions in the console and when running php -v via PHP script

Hello dear Stackoverflow community, I have encountered an unusual issue with PHP versions on my server (ubuntu), and I'm hoping you can assist me. When I log in to my server via the console (SSH) and ...
aim2k1's user avatar
  • 35
1 vote
2 answers
110 views

log k8s users that execute commands in pods

I want to log activity of users in k8s. I want to log each users that exec commands in pods. for example if a user has username 'user01' in k8s (or openshift) and executes 'whoami' in a pod, I want to ...
Michael Cab's user avatar
0 votes
1 answer
55 views

Is there something similar to execlp() that doesn't replace your current process?

I am looking for something that works similar to unistd.h's execlp(), but spawns a new child process instead of replacing your current one. Does something like this exist? I use Arch Linux, in case it ...
Leo's user avatar
  • 102
0 votes
0 answers
24 views

Spyder debugger does not work inside codes that are dynamically executed using the exec() method

I use Anaconda Spyder (version 5.2.2) to debug my Python codes. My codes contain some .py programs that should be executed serially. I use a single routine that executes these codes using the exec() ...
Qasim Elîpûr's user avatar
0 votes
1 answer
58 views

Using `pipe`, `dup2` to duplicate an `exec`ing childs STDOUT - output only shows up when child exits

I've read all the answers for this question on this site and they're all wrong (i.e. flat out does not work, or doesn't do what I want it to). I have a tracer program, that wants to be able to control ...
Simon Farre's user avatar
-1 votes
2 answers
72 views

SQL SERVER execute user define function using Table Type value as parameter + dynamic query execution

I have issue with dynamic query execution in sql server. I have a sql function FUNC_STOCK_VALUATION_COST_TTYPE which gives me result. I am calling this function. using below method: DECLARE @...
Parth M. Dave's user avatar
0 votes
0 answers
42 views

How to use find command to copy .toml files preserving directory structure in Docker?

I am trying to build a Docker image that copies all the .toml files from a specific directory on the host machine into the Docker image while preserving the directory structure. I want to achieve this ...
Bosser445's user avatar
  • 313
1 vote
0 answers
56 views

Empty output of exec while controller is running on cluster

I have a controller with one function to execute commands in the pods (same namespace as the operator). I'm able to see the output while controller is started locally, when the same controller runs on ...
Lukasz's user avatar
  • 11

1
2 3 4 5
119