Quantcast
Channel: Active questions tagged expect - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 157

xclip not getting stdin from pexpect, or pexpect not sending?

$
0
0

This

import pexpectdef run(cmd, stdin):    child = pexpect.spawn(cmd, encoding='utf-8')    child.send(stdin)    child.sendeof()run('xclip -selection clipboard', 'lol')

should copy string lol into my clipboard, so that I paste it around by Ctrl+v.

But, instead, I get the behaviour of echo -n '' | xclip -selection clipboard i.e. the behaviour of passing empty file as STDIN into xclip.

Why?


UPDATE

This prints lollxl instead of just lxl:

import pexpectdef run(cmd, stdin):    child = pexpect.spawn(cmd, encoding='utf-8')    child.send(stdin)    child.sendeof()    child.sendeof()    x = child.read()    child.wait()    return xx = run("sed --expression='s/o/x/g'", 'lol')print(x)

Viewing all articles
Browse latest Browse all 157

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>