test for symbol table/package lookup bug
[urisagit/Stem.git] / bin / hello_demo
CommitLineData
4536f655 1#!/usr/local/bin/perl -s
2
3use strict ;
4use warnings ;
5our $s ;
6
7if ( -d 'conf' && -e 'bin/run_stem' ) {
8
9 $ENV{PERL5LIB} = 'lib' ;
10 $ENV{PATH} = "bin:$ENV{PATH}" ;
11}
12
13print "HELLO DEMO\n" ;
14
15$SIG{ 'INT' } = \&cleanup ;
16
17my @children ;
18
19my $ssfe = $s ? 'ssfe -prompt Stem:' : '' ;
20my $echo = $s ? 'console_echo=1' : '' ;
21
22my $cmd = <<CMD ;
23xterm -T Hello -n Hello -geometry 80x40+0+0 -e $ssfe run_stem $echo hello
24CMD
25
26print "$cmd\n" ;
27
28my @cmd = split ' ', $cmd ;
29s/:/: / for @cmd ;
30
31fork_exec( @cmd ) ;
32
33while( <STDIN> ) {
34
35 next unless /^q/i ;
36
37 cleanup() ;
38}
39
40sub cleanup {
41
42 print "clean up\n" ;
43
44 kill 9, @children ;
45
46 wait ;
47 exit ;
48
49}
50
51sub fork_exec {
52
53 my( @exec ) = @_ ;
54
55 if ( my $pid = fork() ) {
56
57 push @children, $pid ;
58 return ;
59 }
60
61 exec @exec ;
62}