Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9123385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:19:36+00:00 2026-06-17T06:19:36+00:00

This is the code to execute cp.exec(cc -Wall /tmp/test.c -o /tmp/test, function(e, stdout, stderr)

  • 0

This is the code to execute



    cp.exec("cc -Wall /tmp/test.c -o /tmp/test", function(e, stdout, stderr) {
        if (e) {
            var errorstr = "Compilation failed with the following error
"+ e.message.toString() client.send(errorstr) console.log(e, stdout, stderr) ee.prototype.removeAllListeners() } else if (stderr.length > 0) { client.send("Compilion finished with warnings\n"+ stderr + '\n') client.send('compiled') ee.prototype.emit('compiled') } else { client.send("Compilation successful") ee.prototype.emit('compiled') } })

‘client’ is the argument of socket.io’s callback argument. ‘ee’ is an instance of EventEmitter

Coming to the problem. On running the code, the callback says that the command was unsuccessful. console.log(e, stdout, stderr) is

{ [Error: Command failed: ] killed: false, code: false, signal: undefined } '' ''

/tmp/test.c is a valid C code and on checking the directory /tmp , I find that test.c is proper and the binary ‘test’ is being generated and on running in a shell, is properly executed. So I dont understand why it is flagging unsuccessful execution. The error object’s information is unhelpful too. Would appreciate some help/explanation

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:19:37+00:00Added an answer on June 17, 2026 at 6:19 am

    I’m a bit worried about the output in the console.

    { [Error: Command failed: ] killed: false, code: false, signal: undefined }
    

    doesn’t look like a proper JSON/JavaScript object, especially the [Error: Command failed: ] part; there is at least a comma missing.

    Suggestions:

    1. Run the command from the command line and check the exit code (use echo $?). If the exit code is != 0, then this means the command “failed” (whatever that might mean).

    2. When the command fails, nodejs says it will put the exit code into e.code (which I’m missing in your output…). Find out what happened to this value.

    3. Try if(e !== null) instead of if(e). Shouldn’t make a difference, though.

    4. Instead of calling the compiler directly, call a shell script which redirects stderr/stdout to a file (or save a copy using cc ... |& tee /tmp/cc.log) to make sure no part of the complex setup swallows important information.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with JavaScript magic. When I execute this code: var page
With this code: var db = google.gears.factory.create('beta.database'); db.open('cominar'); db.execute('CREATE TABLE IF NOT EXISTS Ajax
Why does this code execute perfectly on Dev-CPP but fails to execute on Borland
When I execute this code the user is correct but the pass is not,
When i execute this code to load a image and store in database it
I was trying to execute this code through gcc compiler: #include <stdio.h> int main()
With doctrine if you execute this code $columns = $accountTable->getColumns(); foreach ($columns as $column)
I'm trying to execute this code (this is a minimal sample in order to
I am trying to execute this code for a listbox but its not working,
If I run this code, will each AppDomain execute in a different thread? ThreadPool.QueueUserWorkItem(delegate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.