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

Greater explanation of error messages #45

Open
mlewis-everley opened this issue Jun 21, 2016 · 9 comments
Open

Greater explanation of error messages #45

mlewis-everley opened this issue Jun 21, 2016 · 9 comments
Labels

Comments

@mlewis-everley
Copy link

At the moment I am getting an error "Execution failed: returned 1."

The command run is apparently: "git '--git-dir=/srv/siteroot/.git' 'config' '--get' 'branch.master.remote'"

The error message isn't very helpful, and I cannot diagnose why it is appearing. Running the command in question does not return an error.

It would be helpful is error's like this generated a hint as to what it is about? I notice error code 2 does this already?

@tractorcow
Copy link

It looks like the bug is here.

https://github.com/silverstripe/sspak/blob/master/src/Executor.php#L148

It should be outputting $result['error'] which has the actual useful error message. Do you want to PR to include this?

@tractorcow
Copy link

I'm going to say bug, since it looks like this code is trying to put output in the message and is using the wrong source. ;P

mlewis-everley added a commit to mlewis-everley/sspak that referenced this issue Jul 13, 2016
Changed the message used by the thrown exception to "error" rather then "output" as mentioned in issue silverstripe#45
@mlewis-everley
Copy link
Author

Ok, so I actually tested the update and it still returns "Execution failed: returned 1." So changing:

https://github.com/silverstripe/sspak/blob/master/src/Executor.php#L148

As you suggest didn't help, any other ideas @tractorcow ?

@mlewis-everley
Copy link
Author

So I dropped a sneaky var_dump in Executor.php and re-built/ran. I can see that the there is an item logged:

array(2) {
'output' => string(0) ""
'return' => int(1)
}

The "return" is 1 so the exception is thrown, but it does not look like sspak see's it as an error as it has an "output" not an "error".

I am not really sure how this result is being reached though...

@dhensby
Copy link
Contributor

dhensby commented Jul 14, 2016

Are we sending any kind of silent or quiet option when running the exec?

@mlewis-everley
Copy link
Author

So I still get this issue, I have noticed however it only seems to crop up when using sspak to save/load a project that is a git repo and checked out to a tag (eg 1.0.0, release-1234 etc).

I cannot see any instances of what looks like the exec being silenced either.

Maybe the Exception should only be thrown when $result['error'] is actually present, so change:

https://github.com/silverstripe/sspak/blob/master/src/Executor.php#L146

to something like:

...

if($options['throwException'] && $result['return'] != 0 && array_key_exists("error", $return))	{

...

@digitall-it
Copy link

I also got this problem,

vagrant@dev:/var/www/public$ sspak save /var/www/public ./backups/2017052301.sspak
Command: git '--git-dir=/var/www/public/.git' 'config' '--get' 'branch.master.remote'
Execution failed: returned 1.

The project is a git repo but not checked out to a tag, not branched, no remote origins, it is local on a vagrant machine.

vagrant@dev:/var/www/public$ git tag
vagrant@dev:/var/www/public$ git branch
* master
vagrant@dev:/var/www/public$ git remote

@jules0x
Copy link

jules0x commented Aug 5, 2019

I've hit the same issue:

sspak save ~/Sites/<site> ~/Desktop/file.sspak

Command: git '--git-dir=/Users/<user>/Sites/<site>/.git' 'config' '--get' 'branch.project/<site>.remote' 
Execution failed: returned 1.

@jules0x
Copy link

jules0x commented Aug 5, 2019

Have identified that .git/config did not have the correct branches listed
I added the below and the problem was resolved.

[branch "project/ss4"]
remote = origin
merge = refs/heads/project/ss4

A reclone of the project correctly populates the values per branch, so this one seems to be specific to the situation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants