Re: Dustmite can't handle my memory segfault

2016-10-22 Thread Anonymouse via Digitalmars-d-learn

On Friday, 21 October 2016 at 10:13:23 UTC, Nordlöw wrote:

#!/usr/bin/env python3

import sys
import pty

stat = pty.spawn(sys.argv[1:])
if stat == 256:
exit(42)# remap to 42
else:
exit(stat)



Assuming you want to remap 134 to 0 (success):

#!/bin/bash

cmd="$1"
shift 2>/dev/null

$cmd "$@"
[ $? = 134 ] && exit 0 || exit 1


Re: Dustmite can't handle my memory segfault

2016-10-21 Thread Nordlöw via Digitalmars-d-learn

On Friday, 21 October 2016 at 06:44:54 UTC, Nordlöw wrote:
On Thursday, 20 October 2016 at 22:18:20 UTC, Vladimir 
Panteleev wrote:

On Thursday, 20 October 2016 at 21:33:59 UTC, Nordlöw wrote:

I need your help here, I'm complete stuck. Vladimir?


The exit status of the `./array_ex` call (as seen from bash) is 
134. How do I, in Bash, map that exit status to zero, and all 
other exit statuses to non-zero?


Solution construct a Bash script named, say show-segfault:


#!/usr/bin/env python3

import sys
import pty

stat = pty.spawn(sys.argv[1:])
if stat == 256:
exit(42)# remap to 42
else:
exit(stat)


and wrap call to rdmd as


show-segfault rdmd ...


Re: Dustmite can't handle my memory segfault

2016-10-21 Thread Nordlöw via Digitalmars-d-learn

Next try:

dustmite --no-redirect src "dmd -main -unittest -g -debug 
array_ex container_traits searching_ex && { ./array_ex; } > 
grep SIGABRT log"


but that fails too as

Loading src/w3c.html
None => /bin/sh: 1: Syntax error: Bad fd number
No
object.Exception@dustmite.d(270): Initial test fails

??:? _Dmain [0x5c6be8]
??:? 
_D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv 
[0x62544e]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int 
function(char[][])*).tryExec(scope void delegate()) [0x625398]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int 
function(char[][])*).runAll() [0x62540a]
??:? void rt.dmain2._d_run_main(int, char**, extern (C) int 
function(char[][])*).tryExec(scope void delegate()) [0x625398]

??:? _d_run_main [0x625309]
??:? main [0x61732d]
??:? __libc_start_main [0x8b69a82f]


I can't get ! operator to work either.


Re: Dustmite can't handle my memory segfault

2016-10-21 Thread Nordlöw via Digitalmars-d-learn
On Thursday, 20 October 2016 at 22:18:20 UTC, Vladimir Panteleev 
wrote:

On Thursday, 20 October 2016 at 21:33:59 UTC, Nordlöw wrote:

I need your help here, I'm complete stuck. Vladimir?


The exit status of the `./array_ex` call (as seen from bash) is 
134. How do I, in Bash, map that exit status to zero, and all 
other exit statuses to non-zero?


Re: Dustmite can't handle my memory segfault

2016-10-20 Thread Vladimir Panteleev via Digitalmars-d-learn

On Thursday, 20 October 2016 at 21:33:59 UTC, Nordlöw wrote:

I need your help here, I'm complete stuck. Vladimir?


If you see output even after redirecting stdout and stderr, the 
program is probably writing to /dev/tty or similar.


I'm not sure what the "proper" way is to run a program without a 
TTY... but what happens if you run the program via ssh, without 
allocating a PTY? I.e. with -T, or with a command and without -t.