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 sure it works in Mac #6

Closed
vitorbaptista opened this issue Jul 15, 2013 · 3 comments
Closed

Make sure it works in Mac #6

vitorbaptista opened this issue Jul 15, 2013 · 3 comments
Assignees

Comments

@vitorbaptista
Copy link
Owner

We might have to use ttyrec to do so. Check shelr for an example.

@ghost ghost assigned domoritz Jul 15, 2013
@domoritz
Copy link
Collaborator

I'm looking into this. It's funny that script on mac does not have -f and -t does something different.

NAME
     script -- make typescript of terminal session

SYNOPSIS
     script [-akq] [-t time] [file [command ...]]

DESCRIPTION
     The script utility makes a typescript of everything printed on your ter-
     minal.  It is useful for students who need a hardcopy record of an
     interactive session as proof of an assignment, as the typescript file
     can be printed out later with lpr(1).

     If the argument file is given, script saves all dialogue in file.  If no
     file name is given, the typescript is saved in the file typescript.

     If the argument command is given, script will run the specified command
     with an optional argument vector instead of an interactive shell.

     The following options are available:

     -a      Append the output to file or typescript, retaining the prior
             contents.

     -k      Log keys sent to program as well as output.

     -q      Run in quiet mode, omit the start and stop status messages.

     -t time
             Specify time interval between flushing script output file.  A
             value of 0 causes script to flush for every character I/O event.
             The default interval is 30 seconds.

@domoritz
Copy link
Collaborator

Should be something like

if platform.system() == 'Darwin':
    shell_args = '-qt 0'
else:
    shell_args = '-qf'

os.system('script %s %s' % (shell_args, filename))

@domoritz
Copy link
Collaborator

Okay, apparently there is a difference in the way files are read. On mac, I can't get the additional content with open(). I'll look into proper pipes. Unless we can solve #2. However, I'm not entirely sure how this is going to work.

domoritz added a commit that referenced this issue Jul 15, 2013
The problem is that script behaves differently on mac os and also  file.read does not return anything after it has read the file once.
domoritz added a commit that referenced this issue Jul 16, 2013
The problem is that script behaves differently on mac os and also file.read does not return anything after it has read the file once. We have to add the seek to make sure that EOF is not cached. See http://docs.python.org/2/library/stdtypes.html#file.read.
vitorbaptista added a commit that referenced this issue Jul 18, 2013
[#6] Hack to make it work on mac os
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants