Skip to content

If an error occurs during an exec call, we get empty output #41

Description

@fpapadopou

Issue description and reproduction steps

When providing G++ or Clang with parameter files that contain parentheses in their names, PHP's exec function breaks and you get sth like this on the stderr output (caught in command line):

sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `avr-g++ -Os -ffunction-sections -fdata-sections -fno-exceptions  -I/arduino-core-files-OSX/v105/hardware/tools/avr/lib/gcc/avr/4.3.2/include -I/arduino-core-files-OSX/v105/hardware/tools/avr/lib/gcc/avr/4.3.2/include-fixed -I/arduino-core-files-OSX/v105/hardware/tools/avr/avr/include  -mmcu=atmega328p -DARDUINO=105 -DF_CPU=16000000 -DUSB_VID=null -DUSB_PID=null -MMD  -I/external_cores/override_cores/arduino/ -I/arduino-core-files-OSX/v105/hardware/arduino/cores/arduino -I/arduino-core-files-OSX/v105/hardware/arduino/variants/standard -I/tmp/compiler.elVKPg/libraries/Ethernet(3) -c -o '/tmp/compiler.elVKPg/files/Blink'.o '/tmp/compiler.elVKPg/files/Blink'.cpp 2>&1'
sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `LD_LIBRARY_PATH=/arduino-core-files-OSX/clang/v3_5/lib:$LD_LIBRARY_PATH /usr/bin/clang --target=msp430 -w -fsyntax-only -fcolor-diagnostics  -I/arduino-core-files-OSX/v105/hardware/tools/avr/lib/gcc/avr/4.3.2/include -I/arduino-core-files-OSX/v105/hardware/tools/avr/lib/gcc/avr/4.3.2/include-fixed -I/arduino-core-files-OSX/v105/hardware/tools/avr/avr/include  -D__AVR_ATmega328P__ -DARDUINO=105 -DF_CPU=16000000  -I/external_cores/override_cores/arduino/ -I/arduino-core-files-OSX/v105/hardware/arduino/cores/arduino -I/arduino-core-files-OSX/v105/hardware/arduino/variants/standard -I/tmp/compiler.elVKPg/libraries/Ethernet(3) -c -o '/tmp/compiler.elVKPg/files/Blink'.o '/tmp/compiler.elVKPg/files/Blink'.cpp 2>&1'

Notice the -I/tmp/compiler.elVKPg/libraries/Ethernet(3) part in both avr-g++ and Clang commands.

As a result, both compilers end up with a syntax error, never executing the requested command.

We do redirect stderr to stdout using 2>&1 in the end of all commands provided to PHP's exec, however this doesn't work for such cases.

Need to find a way to catch this output.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions