macadmins / installapplications

A tool for dynamically using installapplication
Apache License 2.0
285 stars 62 forks source link

stdout from scripts do not get captured #78

Closed erikng closed 4 years ago

erikng commented 4 years ago

this means that things like print() are essentially worthless and you lose context.

erikng commented 4 years ago
            (out, err) = proc.communicate()
            iaslog('Output from %s: %s' % (pathname, out))

this works on both user/root scripts, at the expense of everything coming in as one line.

erikng commented 4 years ago

Fixed as of: https://github.com/macadmins/installapplications/commit/82969c4fd98c8bd12f6137a73aa4f764072a5e47

You'll now see things like:

success:

2020-10-15 12:40:44.634 Python[5971:84686] [InstallApplications] Output on stdout:
2020-10-15 12:40:44.634 Python[5971:84686] [InstallApplications] DEPNotify running - relaunching!

potential failure:

2020-10-15 12:41:02.768 Python[6043:85269] [InstallApplications] Output on stderr but ran successfully:
2020-10-15 12:41:02.768 Python[6043:85269] [InstallApplications] Detected provisioned dock, exiting.

actual failure:

2020-10-15 12:40:59.653 Python[5913:84008] [InstallApplications] Received non-zero exit code:
2020-10-15 12:40:59.653 Python[5913:84008] [InstallApplications] Traceback (most recent call last):
  File "/Library/installapplications/snip.py", line 1188, in <module>
    main()
  File "/Library/installapplications/snip.py", line 704, in main
    while not profile_installed(attributes_profile_id):
  File "/Library/installapplications/snip.py", line 395, in profile_installed
    for profile in plist['_computerlevel']:
KeyError: '_computerlevel'