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

Make the mingw setup script log to a file #49

Closed
bkloster opened this issue Oct 29, 2013 · 6 comments
Closed

Make the mingw setup script log to a file #49

bkloster opened this issue Oct 29, 2013 · 6 comments

Comments

@bkloster
Copy link
Contributor

For troubleshooting, it would be very helpful to log the output of the setup script to a file that users can upload for diagnostics.

The start-transcript and stop-transcript cmdlets may be useful for this, but they have problems as detailed in this bug report. One of the workarounds listed there might be interesting.

@ghost ghost assigned Daniferrito Dec 28, 2013
@Daniferrito
Copy link
Contributor

There is a good solution for this, and is actually quite easy (but maybe not exactly prefered).
Creating a second file, which should be the one being executed instead of the original setup.ps1, and with the following content:

.\setup.ps1 | Tee-Object -FilePath output.txt

Has the desired result (It outputs every single line to the console, as well to the output.txt file).

A very similar thing can be used for the linux version of the script (but maybe there is a better solution to this)

This, however, means that there needs to be an extra file, which could be confusing

@jjonj
Copy link
Contributor

jjonj commented Dec 28, 2013

I don't think the extra file thing is an issue. I'll try your solution now!

EDIT: Works great :)

@Daniferrito
Copy link
Contributor

After writing a 50 lines comment, Firefox crashed and all the comment was deleted. Great. Sorry if this comment lacks too much detail.

If we go with this solution, we will need to decide a few things:

  • What will we call the new and old script files.
  • Where the output log is saved. We can either save it in a subfolder of the mingw_setup folder or at the MinGW destination folder
  • What the output is named.

My suggestions:

  • The new one line file should be called setup.ps1, but I don't know what to call the old one.
  • Save the output to a logs subfolder in the mingw_setup folder, with name setup-date_time.txt or something similar.

I'm going to see how can the same be done for the .sh file, but if i recall correctly, a very similar solution can be obtained with even simpler code.

Edit:
sh setup.sh | tee output.txt

Is the exact same for the sh script. We still need to decide where between the different options i listed beore

@jjonj
Copy link
Contributor

jjonj commented Dec 29, 2013

I don't know what to call the old one.

setup-no-log.ps1 would be fine i think, not too important.

Save the output to a logs subfolder in the mingw_setup folder, with name setup-date_time.txt or something similar.

This depends on how exactly nimbal wants the debugging information but i honestly think a single overwriting setup-output.txt file would be enough! :)

@Daniferrito
Copy link
Contributor

Ok, i'm going to make the changes and hopefully remember how to make a pull request. This, however, might conflict with other branches as the setup.ps1 file will now be completelly diferent, and other branches that are based on the current setup that modify that file will need to be changed manually (and by that i mean the sound branch)

Edit: I'll make the new files be called setup-logged.ps1 That prevents the conflicting branches and is easy to change anyway afterwards.

Edit2: Oops, i believe i just pushed the changes. But creating a whole new branch for that seemed unnecesary, and it seems that i cannot create a pull request directly from my computer

@jjonj
Copy link
Contributor

jjonj commented Dec 29, 2013

Yeah there'll have to be some merging action, but nothing too troublesome i imagine!

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

No branches or pull requests

3 participants