Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

launch occurs even if preLaunchTask fails #3895

Closed
JanKok opened this issue Mar 9, 2016 · 4 comments
Closed

launch occurs even if preLaunchTask fails #3895

JanKok opened this issue Mar 9, 2016 · 4 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Milestone

Comments

@JanKok
Copy link

JanKok commented Mar 9, 2016

I'm trying to do C code development using WebFreak001's gdb debugger extension. Regardless of whether and how preLaunchTask fails, Code always tries to launch the application. I tried pretty much every type of error and variations of arguments in the json files, and it always tried to launch my target app (gm).

This is on Ubuntu 14.04LTS. Originally I was doing make as the prelaunch task, and Code was launching even if the make had errors. The following code demonstrates the problem without using make.

Here is my launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug",
            "type": "gdb",
            "request": "launch",
            "target": "gm",
                        //"arguments": "-d '' -i gm.ini.stdtest",
            "cwd": "${workspaceRoot}",
                        //"terminal": "",
                        "preLaunchTask": "returnv"
        }
    ]
}

Here is my tasks.json:

{
    "version": "0.1.0",
    "command": "returnv",
        "args": ["1"],
    // The command is a shell script
    "isShellCommand": false,
    // Show the output window only if unrecognized errors occur.
    "showOutput": "silent"
    //"problemMatcher": "$tsc"
}

It doesn't really matter if gm or returnv even exist (Code will still try to launch gm if returnv is not found), but anyway here is returnv.c . If it's compiled and Code finds it, I can tell that it's running properly from the printout in the Output window.

#include <stdlib.h>
#include <stdio.h>
int main(int argc, char *argv[]) {
    printf("argc=%d argv[1]-'0'=%d\n", argc, *(argv[1])-'0');
    exit(*(argv[1])-'0');  // exit with return code given in 1st arg
}
@isidorn isidorn mentioned this issue Mar 9, 2016
@isidorn isidorn added bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues labels Mar 9, 2016
@isidorn isidorn added this to the March 2016 milestone Mar 9, 2016
@JanKok
Copy link
Author

JanKok commented Mar 9, 2016

After writing the above issue, I downloaded VSCode v0.10.10. Now Code won't launch if the preLaunchTask returns an error (yay!), however if it can't find the preLaunchTask executable, it WILL still try to launch the target app.

@isidorn
Copy link
Contributor

isidorn commented Mar 9, 2016

Closing since user said in #3826 this issue is fixed

@isidorn isidorn closed this as completed Mar 9, 2016
@JanKok
Copy link
Author

JanKok commented Mar 9, 2016

@isidorn The main problem is fixed, so for example if there is a compile error during a make, Code won't try to run the target app. However, after further testing, I found that with other types of problems, e.g. preLaunchTask not found in tasks.json, or the executable (make, etc) not found, then Code still tries to launch the target app, which is probably not what we want.

In that case, Code displays a one-line error message "Error Could not find the preLaunchTask 'make'" but it's easy to miss that when the user's app runs. It can cause confusion because it may be an old version of the app, since it was not rebuilt with make.

So there is still a problem which could trip people up while getting the Code environment set up. Code should give a (perhaps more visible) error message and NOT launch the target app.

@isidorn
Copy link
Contributor

isidorn commented Mar 10, 2016

@JanKok agree, thanks for the great feedback, I have pushed a fix to adress this issue

@isidorn isidorn assigned bpasero and unassigned isidorn Mar 10, 2016
@bpasero bpasero added the verified Verification succeeded label Mar 14, 2016
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

3 participants